<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title>Document</title>
</head>
<body>
    <input type="text" id="ipt">
    <script>
        let obj = {};

        let val = '';

        Object.defineProperty(obj,'msg',{
            set(newVal){
                console.log("设置值")
                val = newVal;
                document.querySelector("#ipt").value = newVal;
            },
            get(){
                console.log("获取值")
                return val;
            }
        })

        document.querySelector('#ipt').addEventListener('input',(e) => {
            obj.msg = e.target.value;
        })
    </script>

    <!-- 
        作业：1.上午两个算法题  移动0  2.MVVM  简易版  3.复习class Promise 完成Util类的封装

        1>效果录屏 1.5小时录屏展示+代码+效果  

        2>代码提交git
    -->
</body>
</html>